import React, {Component} from 'react';
import {Redirect, Route, Switch, withRouter} from 'react-router-dom';
import Login from "./components/Login";
import FrameLayout from "./components/FrameLayout";
import {connect} from "react-redux";
import AuthorizedRoute from "./routes/AuthorizedRoute";

class Page extends Component {


    render() {
        return (

            <Switch>
                <Route path="/login" component={Login}/>
                <AuthorizedRoute path="/app" component={FrameLayout} />
                {/*<RequireAuthRoute  path='/app' authenticated="212121" component={FrameLayout}/>*/}
                {/*<Route path="/app" component={FrameLayout}/>*/}
                <Redirect to="/app" from='/' exact/>
            </Switch>

        );
    }
}

const mapStateToProps = (state) => {
    return {
        ...state.user,
        ...state.app,
        ...state.auth,
        token:"ssss",
    };
};
// export default connect(mapStateToProps)(withRouter(Page));
export default Page;


/* <Router>
                <Switch>
                    <Route path="/app" render={(routerProps) => {
                        return <FrameLayout {...routerProps}/>
                    }}/>

                    {
                        mainRouter.map(route => {

                            return <Route key={route.path} path={route.path}

                                          component={route.component}
                            />
                        })}


                    <Redirect to="/app" from='/' exact/>
                    <Redirect to="/404"/>
                </Switch>
            </Router>*/


{/*这个地方进行判断*/
}
{/*<Route path="/app" component={FrameLayout}/>*/
}
{/*<Route path="/app" render={(routerProps) => {*/
}
{/*return <FrameLayout {...routerProps}/>*/
}
{/*}}/>*/
}
{/*{*/
}
{/*mainRouter.map(route => {*/
}
{/*console.log(route);*/
}
{/*return <Route key={route.path} path={route.path}*/
}
{/*component={route.component}*/
}
{/*/>*/
}
{/*})*/
}
{/*}*/
}
{/*<Redirect to="/app" from='/' exact/>*/
}
{/*<Redirect to="/404"/>*/
}
{/*-------------------*/
}
{/*<Route path="/app" component={FrameLayout}/>*/
}
{/*<Route path="/404" component={NotFound}/>*/
}
{/*<Route path="/login" component={Login}/>*/
}
{/*<Redirect to="/app" from='/' exact/>*/
}
